<template>
  <el-dialog
    :visible="value"
    :before-close="cancel"
    width="30%"
    class="level-details-view"
  >
    <template slot="title">
      层级类型
    </template>
    <div>
      <div class="header-view">
        已设置支付的层级
      </div>
      <div class="section-view">
        <div
          v-for="item in levelDetailList"
          :key="item.levelId"
        >
          {{item.name}}
        </div>
      </div>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button @click="cancel">取 消</el-button>
      <el-button type="primary" @click="onClickConfirm">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>

// services
import {
  getWithdrawLevelDetail,
} from '@/services/api/payment';

// mixins
import { grid } from '@/build';

export default {
  name: 'level-details-dialog',
  mixins: [grid],
  props: {
    rowData: {
      type: Object,
      required: true,
      default: () => ({
        itemList: [],
      }),
    },
    value: {
      type: Boolean,
      default: true,
    },
  },
  data() {
    return {
      levelDetailList: [],
    };
  },
  computed: {
    content() {
      return this.rowData.content;
    },
  },
  methods: {
    onClickConfirm() {
      this.$emit('confirm');
      this.cancel();
    },
    cancel() {
      this.$emit('input', false);
    },
  },
  mounted() {
    this.bindGet(getWithdrawLevelDetail, 'levelDetailList', {
      sendingData: this.rowData,
    });
    this.getAll();
  },
};
</script>

<style lang="scss">
  .level-details-view {
    .header-view {
      padding-bottom: 15px;
      font-size: 15px;
      font-weight: 800;
    }

    .section-view {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;

      > div {
        min-width: 30%;
        height: 30px;
        line-height: 30px;
      }
    }
  }
</style>
